import Request from './request.js'
let request = new Request().http

const apiList = {
	serverList: '/api/WeChat/GetFileList',
	login: '/api/WeChat/Login', // ?Account=admin&Password=admin
	searchAddress: '/api/WeChat/GetHouse',
	saveNotify: '/api/WeChat/SaveNotify',
	saveCheck: '/api/WeChat/SaveInspect',
	getNotifyList: '/api/WeChat/GetNotifyList',
	getCheckList: '/api/WeChat/GetInspectList',
	getProblems: '/api/WeChat/GetDataDic?DataType=Problems',
	getNotifyById: '/api/WeChat/GetNotifyById',
	getCheckById: '/api/WeChat/GetInspectById',
	getDataDic: '/api/WeChat/GetDataDic',
	sendValidCode: '/api/WeChat/SendValidCode',

	saveComplaint: '/api/WeChat/SaveComplaint',
	getComplaintList: '/api/WeChat/GetComplaintList',
	getComplaintById: '/api/WeChat/GetComplaintById',

	saveProjectApply: '/api/WeChat/SaveProjectApply',
	getProjectApplyList: '/api/WeChat/GetProjectApplyList',
	getProjectApplyById: '/api/WeChat/GetProjectApplyById',

	saveProjectAccept: '/api/WeChat/SaveProjectAccept',
	getProjectAcceptList: '/api/WeChat/GetProjectAcceptList',
	getProjectAcceptById: '/api/WeChat/GetProjectAcceptById',

	saveTaskApply: '/api/WeChat/SaveTaskApply',
	getTaskApplyList: '/api/WeChat/GetTaskApplyList',
	getTaskApplyById: '/api/WeChat/GetTaskApplyById',

	saveTaskAccept: '/api/WeChat/SaveTaskAccept',
	getTaskAcceptList: '/api/WeChat/GetTaskAcceptList',
	getTaskAcceptById: '/api/WeChat/GetTaskAcceptById',

	getEditState: '/api/WeChat/GerEditState',
	getOrg: '/api/WeChat/GetOrg',
}

export const getNotifyById = function(data) {
	return request({
		url: apiList.getNotifyById,
		method: 'GET',
		data: data
	})
}

export const getCheckById = function(data) {
	return request({
		url: apiList.getCheckById,
		method: 'GET',
		data: data
	})
}

export const getServerFileList = function(data) {
	return request({
		url: apiList.serverList, //请求头
		method: "GET", //请求方式
		params: data, //请求数据
	})
}

export const login = function(data) {
	return request({
		url: apiList.login, //请求头
		method: "GET", //请求方式
		data: data, //请求数据
	})
}

export const searchAddress = function(data) {
	return request({
		url: apiList.searchAddress, //请求头
		method: "GET", //请求方式
		data: data, //请求数据
	})
}

export const saveNotify = function(data) {
	return request({
		url: apiList.saveNotify,
		method: 'POST',
		data: data
	})
}

export const saveCheck = function(data) {
	return request({
		url: apiList.saveCheck,
		method: 'POST',
		data: data
	})
}

export const getNotifyList = function(data) {
	return request({
		url: apiList.getNotifyList,
		method: 'GET',
		data: data
	})
}

export const getCheckList = function(data) {
	return request({
		url: apiList.getCheckList,
		method: 'GET',
		data: data
	})
}

export const getProblems = function(data) {
	return request({
		url: apiList.getProblems,
		method: 'GET'
	})
}

export const getDataDic = function(type) {
	return request({
		url: `${apiList.getDataDic}?DataType=${type}`,
		method: 'GET'
	})
}

export const sendValidCode = function(phone) {
	return request({
		url: `${apiList.sendValidCode}?Phone=${phone}`,
		method: 'GET'
	})
}

export const saveComplaint = function(data) {
	return request({
		url: apiList.saveComplaint,
		method: 'POST',
		data: data
	})
}

export const getComplaintList = function(phone) {
	return request({
		url: `${apiList.getComplaintList}?Phone=${phone}`,
		method: 'GET'
	})
}

export const getComplaintById = function(id) {
	return request({
		url: `${apiList.getComplaintById}?id=${id}`,
		method: 'GET'
	})
}

export const saveProjectApply = function(data) {
	return request({
		url: apiList.saveProjectApply,
		method: 'POST',
		data: data
	})
}

export const getProjectApplyList = function(phone) {
	return request({
		url: `${apiList.getProjectApplyList}?Phone=${phone}`,
		method: 'GET'
	})
}

export const getProjectApplyById = function(id) {
	return request({
		url: `${apiList.getProjectApplyById}?id=${id}`,
		method: 'GET'
	})
}

export const saveProjectAccept = function(data) {
	return request({
		url: apiList.saveProjectAccept,
		method: 'POST',
		data: data
	})
}

export const getProjectAcceptList = function(phone) {
	return request({
		url: `${apiList.getProjectAcceptList}?Phone=${phone}`,
		method: 'GET'
	})
}

export const getProjectAcceptById = function(id) {
	return request({
		url: `${apiList.getProjectAcceptById}?id=${id}`,
		method: 'GET'
	})
}

export const saveTaskApply = function(data) {
	return request({
		url: apiList.saveTaskApply,
		method: 'POST',
		data: data
	})
}

export const getTaskApplyList = function(phone) {
	return request({
		url: `${apiList.getTaskApplyList}?Phone=${phone}`,
		method: 'GET'
	})
}

export const getTaskApplyById = function(id) {
	return request({
		url: `${apiList.getTaskApplyById}?id=${id}`,
		method: 'GET'
	})
}

export const saveTaskAccept = function(data) {
	return request({
		url: apiList.saveTaskAccept,
		method: 'POST',
		data: data
	})
}

export const getTaskAcceptList = function(phone) {
	return request({
		url: `${apiList.getTaskAcceptList}?Phone=${phone}`,
		method: 'GET'
	})
}

export const getTaskAcceptById = function(id) {
	return request({
		url: `${apiList.getTaskAcceptById}?id=${id}`,
		method: 'GET'
	})
}

export const getEditState = function(id) {
	return request({
		url: `${apiList.getEditState}`,
		method: 'GET'
	})
}

export const getOrg = function(id) {
	return request({
		url: `${apiList.getOrg}`,
		method: 'GET'
	})
}